package com.du.User.service.impl;

import com.du.User.mapper.GroupMapper;
import com.du.User.mapper.UserMapper;
import com.du.User.pojo.Group;
import com.du.User.pojo.User;
import com.du.User.service.UserService;
import com.du.User.vo.UserQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Resource
    private GroupMapper groupMapper;

    @Override
    public User login(User user) {
        return userMapper.getUser(user);
    }

    @Override
    public List<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    public List<User> getUserList(UserQuery param) {
        return userMapper.getUserList(param);
    }

    @Override
    public Long countUserList(UserQuery param) {
        return userMapper.countUserList(param);
    }

    @Override
    public void addUser(User user) {
      userMapper.addUser(user);
    }

    @Override
    public List<Group> getAllGroup() {
        return groupMapper.getAllGroup();
    }

    @Override
    public void deleteUserByIds(String ids) {
        userMapper.deleteUserByIds(ids);
    }

    @Override
    public User getUserById(Integer sid) {
        return userMapper.getUserById(sid);
    }

    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }
}
